# Maintainer: David Runge <dvzrv@archlinux.org>

_name=IMDbPY
pkgname=python-imdbpy
pkgver=2021.4.18
pkgrel=5
pkgdesc="Python bindings for the Internet Movie Database (IMDb)"
url="https://imdbpy.sourceforge.io/"
arch=('any')
license=('GPL2')
depends=('python-lxml' 'python-sqlalchemy')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('512e459f18018b0439ba7162a85b9492d9bb58e7d360258c228e7437ac971c6957b22017561437c7922dbe3251a9150e99d9590b099e72db8034b0cfe13841fa')
b2sums=('6bf709a132497ac8acaefadba8c133abb3fc0993e59c4fefe62cf77a515b50bad5ff5c46acdc1d1e8f4e903c21c8bef6f59c795822022274ccb946c91113be95')

prepare() {
  mv -v "${_name}-${pkgver}" "${pkgname}-${pkgver}"
}

build() {
  cd "${pkgname}-${pkgver}"
  python setup.py build
}

# # flaky tests are flaky: https://github.com/alberanid/imdbpy/issues/240
# check() {
#   cd "${pkgname}-${pkgver}"
#   export PYTHONPATH="build:${PYTHONPATH}"
#   pytest -v
# }

package() {
  cd "${pkgname}-${pkgver}"
  python setup.py install --optimize=1 --root="${pkgdir}/"
  install -vDm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
# vim:set ts=2 sw=2 et:
